<?php
class View_Admin_Transactions extends View_Admin_Index_Template
{
    public $oTemp;
    
    public function displayTransactionsIndex($oModel)
    {
    	//$oModel->setData('display_menu',1);
        $this->initTemplate($oModel);
        $this->oTemp->assign_file('tempMainContent', PATH_TEMPLATE_ADMIN .'html/transaction_management_index.html');
//        $this->oTemp->assign('pageHeding','TOP PAGE');
		/*$this->oTemp->assign('toobar_new', '?sMod=packet_index&sAction=add_new_form_packet');
        $this->oTemp->parse('main.toobar_new');
        $this->oTemp->assign('toobar_save',"$('frmUpdateCate').submit();");
        $this->oTemp->parse('main.toobar_save');*/
        $array_trans = $oModel->listTransactions();
        $i = 0;
        while($row = $array_trans->fetch_row()){
        	$i ++;
    		$row['no'] = $i;
            $row['css'] = "row" . ($i % 2);
            $row[image_thumb] = ($row[image]!="")?URL_UPLOAD_PACKET_THUMB.$row[image]:URL_UPLOAD_PRODUCT.'no_image.gif';
            $str_pending = "<option value='10'>".$oModel->aLanguage[TRANSACTIONS]['pending']."</option>";
	        $str_success = "<option value='20'>".$oModel->aLanguage[TRANSACTIONS]['success']."</option>";
	        $str_reject = "<option value='30'>".$oModel->aLanguage[TRANSACTIONS]['reject']."</option>";
            if($row[status] == TRANS_PENDING){
//            	$row[status_pending] = " selected='selected' ";
            	$row[status_value] = $oModel->aLanguage[TRANSACTIONS]['pending'];
            	$str_pending = "";
            }
            elseif($row[status] == TRANS_SUCCESS){
//            	$row[status_success] = " selected='selected' ";
            	$row[status_value] = $oModel->aLanguage[TRANSACTIONS]['success'];
				$str_success = "";
            }elseif($row[status] == TRANS_REJECT){
//            	$row[status_reject] = " selected='selected' ";
            	$row[status_value] = $oModel->aLanguage[TRANSACTIONS]['reject'];
				$str_reject = "";
            }
            $row[select_option] = $str_pending.$str_success.$str_reject;
//            var_dump($str_reject);
        	$this->oTemp->assign('row', $row);
        	$this->oTemp->parse('main.rowPacket');
        }
    }
}